//
// ULight.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CVector;

public class ULight {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public ULight(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(ULight obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_ULight(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static ULight createLight() {
    long cPtr = nel3dJNI.ULight_createLight();
    return (cPtr == 0) ? null : new ULight(cPtr, false);
  }

  public void setupDirectional(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector direction, float constant, float linear, float quadratic) {
    nel3dJNI.ULight_setupDirectional__SWIG_0(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(direction), direction, constant, linear, quadratic);
  }

  public void setupDirectional(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector direction, float constant, float linear) {
    nel3dJNI.ULight_setupDirectional__SWIG_1(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(direction), direction, constant, linear);
  }

  public void setupDirectional(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector direction, float constant) {
    nel3dJNI.ULight_setupDirectional__SWIG_2(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(direction), direction, constant);
  }

  public void setupDirectional(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector direction) {
    nel3dJNI.ULight_setupDirectional__SWIG_3(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(direction), direction);
  }

  public void setupPointLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction, float constant, float linear, float quadratic) {
    nel3dJNI.ULight_setupPointLight__SWIG_0(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction, constant, linear, quadratic);
  }

  public void setupPointLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction, float constant, float linear) {
    nel3dJNI.ULight_setupPointLight__SWIG_1(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction, constant, linear);
  }

  public void setupPointLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction, float constant) {
    nel3dJNI.ULight_setupPointLight__SWIG_2(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction, constant);
  }

  public void setupPointLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction) {
    nel3dJNI.ULight_setupPointLight__SWIG_3(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction);
  }

  public void setupSpotLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction, float exponent, float cutoff, float constant, float linear, float quadratic) {
    nel3dJNI.ULight_setupSpotLight__SWIG_0(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction, exponent, cutoff, constant, linear, quadratic);
  }

  public void setupSpotLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction, float exponent, float cutoff, float constant, float linear) {
    nel3dJNI.ULight_setupSpotLight__SWIG_1(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction, exponent, cutoff, constant, linear);
  }

  public void setupSpotLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction, float exponent, float cutoff, float constant) {
    nel3dJNI.ULight_setupSpotLight__SWIG_2(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction, exponent, cutoff, constant);
  }

  public void setupSpotLight(CRGBA ambiant, CRGBA diffuse, CRGBA specular, CVector position, CVector direction, float exponent, float cutoff) {
    nel3dJNI.ULight_setupSpotLight__SWIG_3(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant, CRGBA.getCPtr(diffuse), diffuse, CRGBA.getCPtr(specular), specular, CVector.getCPtr(position), position, CVector.getCPtr(direction), direction, exponent, cutoff);
  }

  public void setupAttenuation(float farAttenuationBegin, float farAttenuationEnd) {
    nel3dJNI.ULight_setupAttenuation(swigCPtr, this, farAttenuationBegin, farAttenuationEnd);
  }

  public void setNoAttenuation() {
    nel3dJNI.ULight_setNoAttenuation(swigCPtr, this);
  }

  public void setupSpotExponent(float hotSpotAngle) {
    nel3dJNI.ULight_setupSpotExponent(swigCPtr, this, hotSpotAngle);
  }

  public void setMode(ULight.TLightMode mode) {
    nel3dJNI.ULight_setMode(swigCPtr, this, mode.swigValue());
  }

  public void setAmbiant(CRGBA ambiant) {
    nel3dJNI.ULight_setAmbiant(swigCPtr, this, CRGBA.getCPtr(ambiant), ambiant);
  }

  public void setDiffuse(CRGBA diffuse) {
    nel3dJNI.ULight_setDiffuse(swigCPtr, this, CRGBA.getCPtr(diffuse), diffuse);
  }

  public void setSpecular(CRGBA specular) {
    nel3dJNI.ULight_setSpecular(swigCPtr, this, CRGBA.getCPtr(specular), specular);
  }

  public void setPosition(CVector position) {
    nel3dJNI.ULight_setPosition(swigCPtr, this, CVector.getCPtr(position), position);
  }

  public void setDirection(CVector direction) {
    nel3dJNI.ULight_setDirection(swigCPtr, this, CVector.getCPtr(direction), direction);
  }

  public void setExponent(float exponent) {
    nel3dJNI.ULight_setExponent(swigCPtr, this, exponent);
  }

  public void setCutoff(float cutoff) {
    nel3dJNI.ULight_setCutoff(swigCPtr, this, cutoff);
  }

  public void setConstantAttenuation(float constant) {
    nel3dJNI.ULight_setConstantAttenuation(swigCPtr, this, constant);
  }

  public void setLinearAttenuation(float linear) {
    nel3dJNI.ULight_setLinearAttenuation(swigCPtr, this, linear);
  }

  public void setQuadraticAttenuation(float quadratic) {
    nel3dJNI.ULight_setQuadraticAttenuation(swigCPtr, this, quadratic);
  }

  public ULight.TLightMode getMode() {
    return ULight.TLightMode.swigToEnum(nel3dJNI.ULight_getMode(swigCPtr, this));
  }

  public CRGBA getAmbiant() {
    return new CRGBA(nel3dJNI.ULight_getAmbiant(swigCPtr, this), true);
  }

  public CRGBA getDiffuse() {
    return new CRGBA(nel3dJNI.ULight_getDiffuse(swigCPtr, this), true);
  }

  public CRGBA getSpecular() {
    return new CRGBA(nel3dJNI.ULight_getSpecular(swigCPtr, this), true);
  }

  public CVector getPosition() {
    return new CVector(nel3dJNI.ULight_getPosition(swigCPtr, this), true);
  }

  public CVector getDirection() {
    return new CVector(nel3dJNI.ULight_getDirection(swigCPtr, this), true);
  }

  public float getExponent() {
    return nel3dJNI.ULight_getExponent(swigCPtr, this);
  }

  public float getCutoff() {
    return nel3dJNI.ULight_getCutoff(swigCPtr, this);
  }

  public float getConstantAttenuation() {
    return nel3dJNI.ULight_getConstantAttenuation(swigCPtr, this);
  }

  public float getLinearAttenuation() {
    return nel3dJNI.ULight_getLinearAttenuation(swigCPtr, this);
  }

  public float getQuadraticAttenuation() {
    return nel3dJNI.ULight_getQuadraticAttenuation(swigCPtr, this);
  }

  public final static class TLightMode {
    public final static TLightMode DirectionalLight = new TLightMode("DirectionalLight");
    public final static TLightMode PointLight = new TLightMode("PointLight");
    public final static TLightMode SpotLight = new TLightMode("SpotLight");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TLightMode swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TLightMode.class + " with value " + swigValue);
    }

    private TLightMode(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TLightMode(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TLightMode(String swigName, TLightMode swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TLightMode[] swigValues = { DirectionalLight, PointLight, SpotLight };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
